package yygh.cmn.listener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import yygh.hospital.model.cmn.Dict;
import yygh.hospital.vo.cmn.DictEeVo;
import org.springframework.beans.BeanUtils;
import yygh.cmn.mapper.DictMapper;


public class DictVoListener extends AnalysisEventListener<DictEeVo> {

    //以构造器的形式创建一个Dictmapper对象

    private DictMapper dictMapper;

    public  DictVoListener(DictMapper dictMapper){
        this.dictMapper=dictMapper;
    }


    //读取的方法
    @Override
    public void invoke(DictEeVo dictEeVo, AnalysisContext analysisContext) {
        //一行一行读取
        Dict dict=new Dict();
        BeanUtils.copyProperties(dict, dictEeVo);
        dictMapper.insert(dict);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
